home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS05.ADF / IFF / readpict.h < prev    next >
C/C++ Source or Header  |  1986-04-20  |  2KB  |  67 lines

  1.  
  2.  
  3. #ifndef READPICT_H
  4. #define READPICT_H
  5. /** ReadPict.h **************************************************************/
  6. /*                                               */
  7. /* Read an ILBM raster image file into RAM.   1/23/86.               */
  8. /*                                               */
  9. /* By Jerry Morrison, Steve Shaw, and Steve Hayes, Electronic Arts.       */
  10. /* This software is in the public domain.                       */
  11. /*                                               */
  12. /* USE THIS AS AN EXAMPLE PROGRAM FOR AN IFF READER.                 */    
  13. /*                                               */
  14. /* The IFF reader portion is essentially a recursive-descent parser.      */    
  15. /****************************************************************************/
  16.  
  17. /* ILBMFrame is our "client frame" for reading FORMs ILBM in an IFF file.
  18.  * We allocate one of these on the stack for every LIST or FORM encountered
  19.  * in the file and use it to hold BMHD & CMAP properties. We also allocate
  20.  * an initial one for the whole file. */
  21. typedef struct {
  22.    ClientFrame clientFrame;
  23.    UBYTE foundBMHD;
  24.    UBYTE nColorRegs;
  25.    BitMapHeader bmHdr;
  26.    Color4 colorMap[32 /*1<<MaxAmDepth*/ ];
  27.    /* If you want to read any other property chunks, e.g. GRAB or CAMG, add
  28.     * fields to this record to store them. */
  29.    } ILBMFrame;
  30.  
  31. /** ReadPicture() ***********************************************************
  32.  *
  33.  * Read a picture from an IFF file, given a file handle open for reading.
  34.  * Allocates BitMap RAM by calling (*Allocator)(size).
  35.  *
  36.  ****************************************************************************/
  37.  
  38. typedef UBYTE *UBytePtr;
  39.  
  40. #ifdef FDwAT
  41.  
  42. typedef UBytePtr Allocator(LONG);
  43.    /* Allocator: a memory allocation procedure which only requires a size
  44.     * argument. (No Amiga memory flags argument.) */
  45.  
  46. extern IFFP ReadPicture(LONG, struct BitMap *, ILBMFrame *, Allocator *);
  47.               /*  file, bm,              iFrame,      allocator  */
  48.    /* iFrame is the top level "client frame". */
  49.    /* allocator is a ptr to your allocation procedure. It must always
  50.     *   allocate in Chip memory (for bitmap data). */
  51.  
  52.    /* PS: Notice how we used two "typedef"s above to make allocator's type
  53.     * meaningful to humans.
  54.     * Consider the usual C style: UBYTE *(*)(), or is it (UBYTE *)(*()) ? */
  55.  
  56. #else /* not FDwAT */
  57.  
  58. typedef UBytePtr Allocator();
  59. extern IFFP ReadPicture();
  60.  
  61. #endif
  62.  
  63. #endif READPICT_H
  64.  
  65.  
  66.  
  67. ready: